<!DOCTYPE html>
<html>
<head>
    <title>图书列表</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            background-color: #f8f9fa;
            padding: 20px 0;
        }
        .book-item {
            background-color: white;
            padding: 20px;
            margin-bottom: 15px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
            border: 1px solid #e9ecef;
            transition: transform 0.2s ease;
        }
        .book-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        }
        .book-title {
            font-size: 18px;
            color: #2c3e50;
            margin-bottom: 8px;
            font-weight: 500;
        }
        .book-info {
            color: #6c757d;
            font-size: 14px;
            display: flex;
            justify-content: space-between;
        }
        .add-btn {
            margin-bottom: 25px;
        }
        .page-header {
            margin-bottom: 30px;
            padding-bottom: 15px;
            border-bottom: 1px solid #dee2e6;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="page-header">
                    <h1 class="text-center">图书列表</h1>
                </div>
                
                <div class="text-end add-btn">
                    <a href="{% url 'add_book' %}" class="btn btn-primary px-4">添加新书</a>
                </div>

                {% for book in books %}
                    <div class="book-item">
                        <div class="book-title">{{ book.title }}</div>
                        <div class="book-info">
                            <span>作者：{{ book.author }}</span>
                            <span>出版日期：{{ book.published_date }}</span>
                        </div>
                    </div>
                {% empty %}
                    <div class="text-center text-muted p-5">
                        <p class="mb-0">暂无图书记录</p>
                    </div>
                {% endfor %}
            </div>
        </div>
    </div>
</body>
</html>
